﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using BusinessObjects.BO_GetObjects;
using System.Web.UI.HtmlControls;

public partial class Pages_Contactus : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        SetMetaTags("Liên hệ");
        LoadLeftModule();
        LoadRightModule();

    }

    protected void SetMetaTags(string title)
    {
        MasterPage master = Page.Master;
        HtmlHead headTag = (HtmlHead)master.Page.Header;
        headTag.Title = "Luật Phúc Trung | " + title;
    }

    protected void LoadLeftModule()
    {
        UserControl controls = (UserControl)Page.LoadControl("../controls/ucContactus.ascx");
        pldHolderLeft.Controls.Add(controls);
        //DataTable objDT = null;
        //objDT = BO_Module.SelectLocation(2);
        //for (int i = 0; i < objDT.Rows.Count; i++)
        //{
        //    if (objDT.Rows[i]["type_id"].ToString() == "1")
        //    {
        //        UserControl controls = (UserControl)Page.LoadControl("../controls/ucSlider.ascx");
        //        Controls_ucSlider control = (Controls_ucSlider)controls;
        //        control.Module_id = objDT.Rows[i]["MODULE_ID"].ToString();
        //        pldHolderLeft.Controls.Add(controls);
        //    }
        //    else if (objDT.Rows[i]["type_id"].ToString() == "2")
        //    {
        //        UserControl controls = (UserControl)Page.LoadControl("../controls/ucFeaturedContent.ascx");
        //        Controls_ucFeaturedContent control = (Controls_ucFeaturedContent)controls;
        //        control.Module_id = objDT.Rows[i]["MODULE_ID"].ToString();
        //        pldHolderLeft.Controls.Add(controls);
        //    }
        //    else if (objDT.Rows[i]["type_id"].ToString() == "7")
        //    {
        //        UserControl controls = (UserControl)Page.LoadControl("../controls/ucFeaturedEbook.ascx");
        //        Controls_ucFeaturedEbook control = (Controls_ucFeaturedEbook)controls;
        //        control.Module_id = objDT.Rows[i]["MODULE_ID"].ToString();
        //        pldHolderLeft.Controls.Add(controls);
        //    }
        //}
    }

    protected void LoadRightModule()
    {
        DataTable objDT = null;
        objDT = BO_Module.SelectLocation(3);
        for (int i = 0; i < objDT.Rows.Count; i++)
        {
            if (objDT.Rows[i]["type_id"].ToString() == "3")
            {
                UserControl controls = (UserControl)Page.LoadControl("../controls/ucCustomSearch.ascx");
                Controls_ucCustomSearch control = (Controls_ucCustomSearch)controls;
                plHolderRight.Controls.Add(controls);
            }
            else if (objDT.Rows[i]["type_id"].ToString() == "4")
            {
                UserControl controls = (UserControl)Page.LoadControl("../controls/ucRegistService.ascx");
                Controls_ucRegistService control = (Controls_ucRegistService)controls;
                plHolderRight.Controls.Add(controls);
            }
            else if (objDT.Rows[i]["type_id"].ToString() == "5")
            {
                UserControl controls = (UserControl)Page.LoadControl("../controls/ucSupport.ascx");
                Controls_ucSupport control = (Controls_ucSupport)controls;
                plHolderRight.Controls.Add(controls);
            }
            else if (objDT.Rows[i]["type_id"].ToString() == "6")
            {
                UserControl controls = (UserControl)Page.LoadControl("../controls/ucAds.ascx");
                Controls_ucAds control = (Controls_ucAds)controls;
                control.Module_id = objDT.Rows[i]["MODULE_ID"].ToString();
                plHolderRight.Controls.Add(controls);
            }
            else if (objDT.Rows[i]["type_id"].ToString() == "7")
            {
                //UserControl controls = (UserControl)Page.LoadControl("../controls/ucRegistService.ascx");
                //Controls_ucRegistService control = (Controls_ucRegistService)controls;
                //pldHolderLeft.Controls.Add(controls);
            }
        }
    }
}